<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/inc/taglib.inc"%>
<%@ include file="/WEB-INF/inc/script.inc"%>
<!DOCTYPE html>
<html>

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="${base}">
<title>中金通 | 订单列表</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">

<!-- FooTable -->
<!-- <link href="css/plugins/footable/footable.core.css" rel="stylesheet"> -->
<!-- Data Tables -->
<link href="css/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">
<link href="css/plugins/dataTables/dataTables.responsive.css"
	rel="stylesheet">
<link href="css/plugins/dataTables/dataTables.tableTools.min.css"
	rel="stylesheet">
<link href="css/plugins/jsTree/style.min.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<link href="css/plugins/dropzone/dropzone.css" rel="stylesheet">
<!-- Sweet Alert -->
<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<link href="css/plugins/datapicker/datepicker3.css" rel="stylesheet">
<link href="js/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet">
<style type="text/css">
	.form-control[readonly]{
		background-color: #fff;
		opacity: 1;
	}
	textarea {
    border: #ffffff;
    resize: none;
    background-color: #fff;
	}
</style>
</head>

<body>

	<div id="wrapper">

		<!-- 左侧菜单 -->
		<jsp:include page="/WEB-INF/jsp/common/main-menu.jsp"></jsp:include>
		<div id="page-wrapper" class="gray-bg">
			<div class="row border-bottom">
				<!-- 头部工具栏区 -->
				<jsp:include page="/WEB-INF/jsp/common/main-header.jsp"></jsp:include>
			</div>
			<div class="row wrapper border-bottom white-bg page-heading">
				<div class="col-lg-10">
					<h2>销售管理</h2>
					<ol class="breadcrumb">
						<li><a href="common/platform">Home</a></li>
						<li><a href="orders/list">订单管理</a></li>
						<li class="active"><strong>订单列表</strong></li>
					</ol>
				</div>
				<div class="col-lg-2"></div>
			</div>
			<input type="text" id="org_id" class="hidden" value="${sessionScope.security_context_user.orgId}"/>
			<div class="row" style="margin-top: 10px;">
				<div class="col-md-12">
					<div class="tabs-container">
					<ul class="nav nav-tabs">
                            <li class="active">
								<a href="orders/list">
									 订单列表
								</a>
							</li>
							<li>
								<a href="orders/entering">
									 线下订单录入
								</a>
							</li>
                        </ul>
						<div class="tab-content">
							<div class="tab-pane active">
								<div class="panel-body">
									<div
										class="wrapper wrapper-content animated fadeInRight ecommerce">
<!-- 											<div class="ibox-title hidden">
												<h5>查询条件</h5>
												<div class="ibox-tools">
													<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
													</a>
												</div>
											</div> -->
											<div class="ibox-content m-b-sm">
												<form id="queryForm" method="post">
													<div class="row">
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="orderId">订单编号</label>
																<input type="text" id="orderId" name="orderId" value=""
																	placeholder="订单编号" class="form-control">
															</div>
														</div>
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="date_added">下单时间</label>
																<div class="input-group date">
																	<span class="input-group-addon"><i
																		class="fa fa-calendar"></i></span><input name="orderTimeStart" id="orderTimeStart"
																		 type="text" class="form-control" value="" readonly="readonly">
																</div>
															</div>
														</div>
														<div class="col-sm-4">
															<label class="control-label" for="date_added">&nbsp;</label>
															<div class="form-group">
																<div class="input-group date">
																	<span class="input-group-addon">至<i
																		class="fa fa-calendar"></i></span><input name="orderTimeEnd" id="orderTimeEnd"
																		 type="text" class="form-control" value="" readonly="readonly">
																</div>
															</div>
														</div>
													</div>
													<div class="row">
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="investorName">投资人姓名</label> <input
																	type="text" id="investorName" name="investorName" value=""
																	placeholder="投资人姓名" class="ui-autocomplete-input form-control" autocomplete="off">
															</div>
														</div>
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="investorMobile">投资人电话</label>
																<input type="text" id="mobile" name="investorMobile" value=""
																	placeholder="投资人电话" class="form-control">
															</div>
														</div>
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="investorIdcard">投资人证件号码</label> <input
																	type="text" id="idcard" name="investorIdcard" value=""
																	placeholder="证件号码" class="form-control">
															</div>
														</div>
													</div>
													<div class="row">
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="employeeName">理财师姓名</label>
																<input type="text" id="employeeName" name="employeeName"
																	value="" placeholder="理财师姓名" class="ui-autocomplete-input form-control" autocomplete="off">
															</div>
														</div>
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="employeeNo">理财师工号</label>
																<input type="text" id="employeeNo" name="employeeNo"
																	value="" placeholder="理财师工号" class="form-control">
															</div>
														</div>
														<div class="col-sm-4">
															<div class="form-group"  style='position:relative;'>
																<label class="control-label" for="groupName" >理财师团队名</label>&nbsp;&nbsp;&nbsp;
																<input type="text" id="groupName" name="groupName" readonly class="form-control" placeholder="理财师团队名"/>
																<div id="empGroupTree" class="popup"></div>
																<input type="hidden" id="groupId" class="form-control" name="groupId"/> 
															</div>
														</div>
													</div>
													<div class="row">
														<div class="col-sm-4">
															<div class="form-group"  style='position:relative;'>
																<label class="control-label" for="productBriefName" >产品简称</label>&nbsp;&nbsp;&nbsp;
																<input type="text" id="productBriefName" name="productBriefName" class="ui-autocomplete-input form-control" autocomplete="off" placeholder="产品简称"/>
															</div>
														</div>
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="state">来源</label>
																	<select id="type" name="type" 
																		class="form-control m-b" tabindex="2">
																		<option value="" selected="selected">所有</option>
																		<option value="0">线上</option>
																		<option value="1">线下</option>
																	</select>
															</div>
														</div>
														<div class="col-sm-4">
															<div class="form-group">
																<label class="control-label" for="state">状态</label>
																	<select id="status" name="state" 
																		class="form-control m-b" tabindex="2">
																		<option value="" selected="selected">所有</option>
																		<option value="2">未支付</option>
																		<option value="4">部分支付</option>
																		<option value="1">已支付</option>
																		<option value="6">已完成</option>
																		<option value="7">即将到期</option>
																		<option value="8">待兑付</option>
																		<option value="3">已兑付</option>
																		<option value="5">已取消</option>
																	</select>
															</div>
														</div>
													</div>
													<div class="row">
														<div class="col-sm-4 col-sm-offset-2">
					                                        <button class="btn btn-outline btn-default pull-right m-t-n-xs" id="cancleQuery" type="reset">重置</button>
					                                        <div class="pull-right">&nbsp;&nbsp;&nbsp;</div>
					                                        <button class="btn btn-primary pull-right m-t-n-xs" id="queryBtn" type="button">查询</button>
					                                    </div>
													</div>
												</form>
											</div>
										<div class="row">
											<div class="col-lg-12">
												<div class="ibox float-e-margins">
<!-- 													<div class="ibox-title">
														<h5>订单列表</h5>
														<div class="ibox-tools">
															<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
															</a>
														</div>
													</div> -->
													<div class="ibox-content">
														<table id="ordersEditable"
															class="table table-striped table-bordered table-hover">
															<thead>
																<tr>
																	<th>合同编号</th>
																	<th>投资人</th>
																	<th>产品</th>
																	<th>订单金额</th>
																	<!-- <th>部门</th> -->
																	<th>理财师</th>
																	<th>下单时间</th>
																	<th>支付时间</th>
																	<th>状态</th>
																	<th>来源</th>
																	<th style="background-color: white;">操作</th>
																</tr>
															</thead>
															<tbody>
															</tbody>

														</table>

													</div>
												</div>
											</div>
										</div>

									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- 底部版权 -->
			<jsp:include page="/WEB-INF/jsp/common/main-footer.jsp"></jsp:include>
		</div>
		<!-- 上传线下支付凭证 -->
		<div class="modal inmodal" id="uploadModal" tabindex="-1" role="dialog"
			aria-hidden="true" style="overflow:auto">
			<div class="modal-dialog modal-lg">
				<div class="modal-content animated fadeIn">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							<span aria-hidden="true">&times;</span><span class="sr-only" id="closeModal">Close</span>
						</button>
						<h4 class="modal-title">上传线下支付凭证</h4>
					</div>
					<div class="modal-body">
						<div class="ibox-content p-xl" id="updateForm" >
							<input name="orderId" id="orderUploadId" type="text" class="form-control" style="display:none" value="">
							<form id="my-awesome-dropzone" class="dropzone" enctype="multipart/form-data" action="orders/imgUploads">
	                            <div class="dropzone-previews"></div>
	                        </form>
	                        <div>
	                        	<div class="m text-left" id="upload"><small><font style="color:red">图片文件个数不得超过5个。</font></small> </div>
	                            <div class="m text-left" id="uploaded"><small><font style="color:red">如果您重新上传打款凭证，先前的打款凭证将会作废，建议一次性上传所有文件，文件个数不得超过5个。</font></small> </div>
	                        </div>
                        </div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-white" data-dismiss="modal">关
							闭</button>
						<button type="submit" class="btn btn-primary" id="uploadConfirm">上传</button>
					</div>
				</div>
			</div>
		</div>
		<!-- 新增联系记录界面 -->
		<div class="modal inmodal" id="addVisitMomal" tabindex="-1" role="dialog"
			aria-hidden="true">
			<div class="modal-dialog modal-sm">
				<div class="modal-content animated flipInY">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
						</button>
						<h4 class="modal-title">新增联系记录</h4>
					</div>
					<div class="modal-body">
						<form id="addVisitForm" method="post">
						<div class="ibox-content p-xl" id="addContactsForm">
                            <div class="row">
								<div class="col-sm-4">
										<div class="form-group">
											<label class="control-label" for="content">内容</label>
											<textarea rows="10" cols="15" name="content"></textarea>
										</div>
								</div>
							</div>
                        </div>
                        </form>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-white" data-dismiss="modal">关
							闭</button>
						<button type="button" class="btn btn-primary" id="addVisitConfirm">确
							认</button>
					</div>
				</div>
			</div>
		</div>
		<!-- 线下支付申请审核 -->
		<div class="modal inmodal" id="offlineAuditMomal" tabindex="-1" role="dialog"
			aria-hidden="true">
			<div class="modal-dialog modal-md">
				<div class="modal-content animated fadeIn">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
						</button>
						<h4 class="modal-title">审核申请开通其它支付方式</h4>
					</div>
					<div class="modal-body">
						<form id="auditForm" class="ibox-content p-xl" method="post">
						<div id="auditBody"></div>
						<script id="auditTemplate" type="text/x-jquery-tmpl">
			                <div class="row">
								<input name="id" type="text" class="form-control" style="display:none" value="{{= payTypeAuditId}}">
								<div class="form-group">
			                    <div class="col-sm-3">
									<label class="control-label">申请人:</label>
				                </div>
			                    <div class="col-md-6">
						            <span>{{= employeeName}}</span>
				                </div>
				                </div>
			                </div>
							<br>
							<div class="row">
			                    <div class="col-sm-3">
									<label class="control-label">申请人部门:</label>
				                </div>
			                    <div class="col-md-6">
									<span>{{if groupName}}{{= groupName}}{{else}}---{{/if}}</span>
				                </div>
			                </div>
							<br>
							<div class="row">
			                    <div class="col-sm-3">
									<label class="control-label">申请时间:</label>
				                </div>
			                    <div class="col-md-6">
									<span>{{= applyTime}}</span>
				                </div>
			                </div>
							<br>
							<div class="row">
			                    <div class="col-sm-3">
									<label class="control-label">申请理由:</label>
				                </div>
			                    <div class="col-md-6">
						           <textarea rows="10" cols="30" readonly="readonly" disabled="disabled">{{= applyReason}}</textarea>
				                </div>
			                </div>
							<br>
							<div class="row">
								<div class="col-sm-3">
									<label class="control-label" >是否开通</label>
				                </div>
			                    <div class="col-sm-6">
			                            <select class="form-control m-b" name="result" >
			                                <option value="1">开通</option>
			                                <option value="0">不开通</option>
			                            </select>
			                    </div>
			                </div>
							<br>
			                <div class="row">
			                	<div class="form-group">
			                         <div class="col-sm-4 col-sm-offset-5">
			                             <button class="btn btn-primary" id="auditBtn" type="button">确 定</button>
			                             <button class="btn btn-white" data-dismiss="modal" type="button">取 消</button>
			                         </div>
			                    </div>
			                </div>
						
						</script>
						</form>
					</div>
					<!-- <div class="modal-footer">
						<button type="button" class="btn btn-white" data-dismiss="modal">关
							闭</button>
						<button type="button" class="btn btn-primary" id="offlineAuditConfirm">确
							认</button>
					</div> -->
				</div>
			</div>
		</div>
	</div>



	<!-- Mainly scripts -->
	<script src="js/jquery-2.1.1.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
	<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="js/plugins/jeditable/jquery.jeditable.js"></script>
	<script src="js/jquery.serialize-object.min.js" type="text/javascript"></script>
	<script src="js/plugins/jquery-ui/jquery-ui.min.js"></script>

	<!-- Data Tables -->
	<script src="js/plugins/dataTables/jquery.dataTables.js"></script>
	<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
	<script src="js/plugins/dataTables/dataTables.responsive.js"></script>
	<script src="js/plugins/dataTables/dataTables.tableTools.min.js"></script>

	<!-- Custom and plugin javascript -->
	<script src="js/inspinia.js"></script>
	<script src="js/plugins/pace/pace.min.js"></script>
	<script src="js/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>

	<!-- Data picker -->
	<script src="js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<!-- jsTree -->
    <script src="js/plugins/jsTree/jstree.min.js"></script>
	<!-- Sweet alert -->
    <script src="js/plugins/sweetalert/sweetalert.min.js"></script>
    <!-- DROPZONE -->
    <script src="js/plugins/dropzone/dropzone.js"></script>

	<!-- Page-Level Scripts -->
	<script src="js/jquery.tmpl.min.js"></script>
	<script src="js/orders/orders-module.js?v=${jsVersion}"></script>
	<!-- popup-layer -->
	<script type="text/javascript" src="js/popup-layer.js"></script>
	<script>
		$(document).ready(function() {
			OrdersModule.init();
			$('#orderTimeStart').datepicker({
				todayBtn : "linked",
				keyboardNavigation : true,
				forceParse : false,
				calendarWeeks : true,
				autoclose : true,
				format: "yyyy-mm-dd",
				language: 'cn',
				/* onSelect: function( startDate ) {
					var $startDate = $( "#orderTimeStart" );
					var $endDate = $('#orderTimeEnd');
					var endDate = $endDate.datepicker( 'getDate' );
					var startDate = $startDate.datepicker( 'getDate' );
					if(endDate != '' && endDate < startDate){
						$startDate.datepicker('setDate', endDate - 3600*1000*24);
					}
					$endDate.datepicker( "option", "minDate", startDate );
				} */
			});
			$('#orderTimeEnd').datepicker({
				todayBtn : "linked",
				keyboardNavigation : true,
				forceParse : false,
				calendarWeeks : true,
				autoclose : true,
				format: "yyyy-mm-dd",
				language: 'cn',
			});
			$('#orderTimeStart').datepicker()
            .on('changeDate', function(ev){
             	var date = $('#orderTimeStart').val();
             	var date2 = $('#orderTimeEnd').val();
             	var startDate = Date.parse(date);
             	var endDate = Date.parse(date2);
             	var today = new Date();
             	var todayTime = today.getTime();
                	if(startDate >= todayTime){
                		bootbox.alert("查询开始时间不能大于当前时间");
                		$('#orderTimeStart').val("");
                	}else if(startDate > endDate){
                		bootbox.alert("查询开始时间不能大于截止时间.");
                		$('#orderTimeStart').val("");
                	}
                	$('#orderTimeStart').datepicker('hide');
            }); 
			$('#orderTimeEnd').datepicker()
            .on('changeDate', function(ev){
             	var date = $('#orderTimeStart').val();
             	var date2 = $('#orderTimeEnd').val();
             	var startDate = Date.parse(date);
             	var endDate = Date.parse(date2);
             	var today = new Date();
             	var todayTime = today.getTime();
                	if(endDate >= todayTime){
                		bootbox.alert("查询结束时间不能大于当前时间");
                		$('#orderTimeEnd').val("");
                	}else if(startDate > endDate){
                		bootbox.alert("查询截止时间不能小于开始时间.");
                		$('#orderTimeEnd').val("");
                	}
                	$('#orderTimeEnd').datepicker('hide');
            }); 

			var pop = new PopupLayer({trigger:"#groupName",popupBlk:"#empGroupTree"});
        	pop.init(pop);
			
		});
	</script>

</body>

</html>
